import Taro, {Component} from '@tarojs/taro'
import {Text, View} from '@tarojs/components'

import {AtAvatar, AtList, AtListItem} from 'taro-ui'

import Tabbar from '../../components/TabBar'

import './index.scss';

class Center extends Component {

    config = {
        navigationBarTitleText: '我的'
    }

    componentDidShow() {
    }

    componentDidHide() {
    }

    onNavigateTo(url) {
        Taro.navigateTo({
            url
        });
    }

    render() {
        return (
            <View className='index'>
                <View className="user-info">
                    <AtAvatar circle size='normal' text='S'/>
                    <Text className='user-name'>我的</Text>
                </View>

                <AtList>
                    <AtListItem
                        title='创建课程'
                        arrow='right'
                        onClick={this.onNavigateTo.bind(this, `/pages/creator/index`)}
                        iconInfo={{value: 'edit'}}
                    />
                    <AtListItem title='我的创建课程' arrow='right' iconInfo={{value: 'clock'}}/>
                    <AtListItem title='我的报名课程' arrow='right' iconInfo={{value: 'bell'}}/>
                    <AtListItem title='使用说明' arrow='right' iconInfo={{value: 'bookmark'}}/>
                    <AtListItem title='联系我们' arrow='right' iconInfo={{value: 'phone'}}/>
                    <AtListItem title='意见反馈' arrow='right' iconInfo={{value: 'iphone-x'}}/>
                </AtList>

                {Taro.getEnv() !== Taro.ENV_TYPE.WEAPP && <Tabbar/>}
            </View>
        )
    }
}

export default Center
